Regular Expression Tokens
This property box lets you build a custom token. The created token will use Pattern Matching to extract specified patterns of information from other tokens or values.
To configure Regular Expression Tokens
- Add the Pattern Matching activity to your workflow definition by dragging it from the Toolbox Pane and dropping it in the Designer Pane.
- Select the activity in the Designer Pane.
- Under Regular Expression Tokens in the Properties Pane, click New Token.
- In the New Pattern dialog box, enter a name for your custom token.
- Next to Input, type in the value you want your pattern to apply to. Click the Token button (right arrow) to use tokens.
- Next to Pattern, type in a regular expression or click the pattern matching button to a build a regular expression that will extract the desired information from the input. Show me a list of regular expressions I can use.
- Select the Allow tokens in the pattern checkbox to have tokens in your pattern be replaced by their value when the activity runs. You may want to allow tokens if you have a generic workflow that retrieves patterns from a database registry based off a field value or template. If this checkbox is selected, you can edit tokens in your pattern by right-clicking them. Clear this checkbox if you have regular expression syntax that you don't want mistaken for a token. If this checkbox is cleared, tokens will not be replaced and token syntax will be interpreted as regular expression syntax.
- Under Options, select Case Sensitive if you want the pattern matching process to respect case when looking for the desired information (the match).
- If multiple matches exist, you can select to return:
- First match only: Returns only the first value that matches the pattern.
- All matches (combined with no spaces): Returns all values as a single-valued token.
- All matches (as multi-value token): Returns all values as a multi-value token.
Example: If the input values are 123 456 789 and you apply the regular expression [0-9]+, the activity will return one match: 123.
Example: If the input values are 123 456 789 and you apply the regular expression [0-9]+, the activity will return 123456789. It ignores the characters that do not match the pattern.
Example: If the input values are 123 456 789 and you apply the regular expression [0-9]+, the activity will return 123, 456, and 789. The three values will be listed in a multi-value token.
- Click Click here to test the pattern to validate your token. In the testing area, type a sample value in the Test Input text box. The information your regular expression extracted from the sample input value will appear under Result.
- Click OK.
- Optional: You can add to and organize your custom tokens in the Regular Expressions Tokens property box in the Properties Pane.
- Hide the expression details in the Regular Expressions Tokens property box by clicking Hide Details.
- Modify a custom token by clicking on the custom token's name or expression.
- Create additional tokens by clicking New Token.
- Delete a token by clicking the red X .
- Reorder custom tokens in the Regular Expressions Tokens property box by clicking the green arrows to move the tokens up or down on the list.
Note: In the Test Input text box, line breaks are treated as part of the test value and not as multiple values of a multi-value token. This functionality allows you to test the input from a token that is likely to include line breaks, such as the Text token of the Retrieve Document Text activity. You can display the line breaks as characters by checking Show link break characters as \r and \n .
Note: You can use tokens created with this activity to create more tokens within the same activity. To reference a token created in this activity, the referenced token must be listed before the token that refers to it in the Regular Expressions Tokens property box.